import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;

import javax.wsdl.WSDLException;
import javax.xml.stream.XMLStreamException;

import at.ac.tuwien.infosys.dsg.daios.exceptions.AmbigiousException;
import at.ac.tuwien.infosys.dsg.daios.framework.DefaultInterceptor;
import at.ac.tuwien.infosys.dsg.daios.framework.ServiceFrontend;
import at.ac.tuwien.infosys.dsg.daios.framework.ServiceFrontendFactory;
import at.ac.tuwien.infosys.dsg.daios.framework.interfaces.IServiceFrontendImplementor;


public class DaiosIntTest {

	/**
	 * @param args
	 * @throws IOException 
	 * @throws XMLStreamException 
	 * @throws AmbigiousException 
	 * @throws WSDLException 
	 * @throws MalformedURLException 
	 */
	public static void main(String[] args) throws MalformedURLException, WSDLException, AmbigiousException, XMLStreamException, IOException {
		
		ServiceFrontendFactory fac = ServiceFrontendFactory.getFactory
				("at.ac.tuwien.infosys.dsg.daiosPlugins." +
				 "nativeInvoker.NativeServiceInvokerFactory");
		
		ServiceFrontend frontend = fac.createFrontend(
				new URL("http://localhost:8080/axis2/services/DADocTestService?wsdl"),
				"SOAP",
				new DefaultInterceptor() {

					public void doHTTPInvocation(String endpoint, String body,
							IServiceFrontendImplementor invoker) {
						
						System.out.println("HTTP Request: ");
						System.out.println(body);
						
					}

					public void receiveHTTPResult(String endpoint, String body,
							IServiceFrontendImplementor invoker, String response) {
						
						System.out.println("HTTP Response: ");
						System.out.println(response);
						
					}
					
				});
		
	}

}
